import { axios } from './config'

// 登录
export const loginRest = params => {
    return axios.post(`/login`, params)
}
export const getCaptchaRest = params => {
    return axios.get(`/login/captcha`, { responseType: 'blob', params: params })
}

// 退出
export const logoutRest = () => {
    return axios.get(`/loginout`)
}

// 首页
export const getUnreadListRest = () => {
    return axios.get(`/index/message/unreadNotice`, {})
}

export const getUnreadNumRest = () => {
    return axios.get(`/index/message/unreadNum`, {})
}

// 机关党委
export const getPartyListRest = params => {
    return axios.get(`/party/list`, { params: params })
}

export const getPartyRest = params => {
    return axios.get(`/party/view/${params}`, {}) 
}

export const addPartyRest = params => {
    return axios.post(`/party/add`, params)
}

export const editPartyRest = params => {
    return axios.post(`/party/edit`, params)
}

export const deletePartyRest = params => {
    return axios.post(`/party/delete/${params}`, {})
}

export const getParentListRest = params => {
    return axios.get(`/party/getPrentList?level=${params}`, {})
}

export const getSubListRest = params => {
    return axios.get(`/party/getSubList?fid=${params}`, {})
}

export const getTreeListRest = () => {
    return axios.get(`/party/getTreeList`, {})
}
export const getTreeListAllRest = () => {
    return axios.get(`/party/getTreeListAll`, {})
}

// 党员
export const getMemberListRest = params => {
    return axios.get(`/employee/list`, {params: params})
}

export const getMemberListByDeptRest = params => {
    return axios.get(`/employee/getListByDept/${params}`, {})
}

export const getMemberRest = params => {
    return axios.get(`/employee/view/${params}`, {})
}

export const addMemberRest = params => {
    return axios.post(`/employee/add`, params)
}

export const editMemberRest = params => {
    return axios.post(`/employee/edit`, params)
}

export const deleteMemberRest = params => {
    return axios.post(`/employee/delete/${params}`, {})
}

// 文件管理
export const fileMessageListRest = params => {
    return axios.post(`/fileMessage/list`, params)
}

export const sendFileMessageListRest = params => {
    return axios.post(`/fileMessage/getMyList`, params)
}

export const deleteFileMessageRest = params => {
    return axios.post(`/fileMessage/delete/${params}`, {})
}

export const sendFileMessageRest = params => {
    return axios.post(`/fileMessage/send`, params)
}

export const getFileMessageRest = params => {
    return axios.post(`/fileMessage/view/${params}`, {})
}

export const downloadFileRest = params => {
    return axios({
        url: `/down/file`,
        method: 'get',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'
        },
        responseType: 'blob',
        params: params,
        timeout: 20 * 60 * 1000
    })
}

// 消息管理
export const getMessageListByDeptRest = params => {
    return axios.get(`/message/list?type=${params.type}`, {})
}

export const getMessageListRest = params => {
    return axios.get(`/message/getList`, {params: params})
}

export const sendMessageRest = params => {
    return axios.post(`/message/send`, params)
}

export const sendMessageListRest = params => {
    return axios.get(`/message/sendList`, { params: params })
}

export const viewMessageRest = params => {
    return axios.post(`/message/view/${params}`, {})
}

export const deleteMessageRest = params => {
    return axios.post(`/message/delete/${params}`, {})
}

// 注册
export const registerRest = params => {
    return axios.post(`/tenant/register`, params)
}

// 用户
export const addUserRest = params => {
    return axios.get(`/user/add`, { params: params })
}

export const deleteUserRest = params => {
    return axios.get(`/user/delete/${params.id}`, {})
}

export const getUserListRest = () => {
    return axios.get(`/user/list`, {})
}

export const getUserListNoselfRest = () => {
    return axios.get(`/user/noselfList`, {})
}

export const changeUserPwdRest = params => {
    return axios.get(`/user/pwd`, { params: params })
}

// 账户
export const getAccountListRest = params => {
    return axios.get(`/account/list`, {params: params})
}

export const editAccountRest = params => {
    return axios.post(`/account/edit`, params)
}

export const viewAccountRest = params => {
    return axios.get(`/account/view/${params}`, {})
}

// 三会
export const meetingCreate = params => {
    return axios.post(`/meeting/create`, params)
}
export const meetingEdit = params => {
    return axios.post(`/meeting/edit`, params)
}
export const meetinglist = params => {
    return axios.post(`/meeting/list`, params)
}
export const meetingView = params => {
    return axios.get(`/meeting/view/${params}`, {})
}
export const meetingDel = params => {
    return axios.get(`/meeting/delete/${params}`, {})
}
export const employeeAll = () => {
    return axios.get(`/employee/listAll`, {})
}


// 党日活动
export const advicelist = params => {
    return axios.post(`/advice/list`, params)
}
export const adviceCreate = params => {
    return axios.post(`/advice/create`, params)
}
//修改
export const adviceEdit = params => {
    return axios.post(`/advice/edit`, params)
}
export const adviceDel = params => {
    return axios.get(`/advice/delete/${params}`, {})
}
export const adviceView = params => {
    return axios.get(`/advice/view/${params}`, {})
}
//党课
export const classList = params => {
    return axios.post(`/class/list`, params)
}
export const classCreate= params => {
    return axios.post(`/class/create`, params)
}
//修改
export const classEdit= params => {
    return axios.post(`/class/edit`, params)
}
export const classDel = params => {
    return axios.get(`/class/delete/${params}`, {})
}
export const classView = params => {
    return axios.get(`/class/view/${params}`, {})
}
// 
//文件上传
export const uploadFile = params => {
    return axios.post(`/upload/file`, params)
}
// 用户
export const userView = () => {
    return axios.get(`/user/view`, {})
}
//保存用户
export const userEdit = params => {
    return axios.post(`/user/edit`, params)
}
// /user/view
// /upload/file
// 
// 